home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.0 / stk-3 / blt-for-STk-3.0 / blt-1.9 / demos / htext.txt < prev    next >
Encoding:
Text File  |  1995-07-01  |  20.2 KB  |  619 lines

  1.         This is a (for lack of a better name) hypertext widget.
  2.  
  3. This widget combines text and other Tk widgets in the same window. 
  4. It is sort of a cross between a read-only text widget and the pack command.  
  5. Any widget can be attached to the hypertext window by the %% 
  6. label $blt_htext(widget).lab -text "append " -relief sunken \
  7.         -font *-Courier-Bold-R-Normal-*-120-*
  8. $blt_htext(widget) append $blt_htext(widget).lab 
  9. %% command.
  10. For example, 
  11. %% message $blt_htext(widget).msg -relief sunken -bd 2 -aspect 10000 -font \
  12.  *-Courier-Medium-R-Normal-*-120-* -text {set w $blt_htext(widget)
  13. if { $tk_version < 4.0 } {
  14. label $w.face -bitmap @bitmaps/face \ 
  15.   -relief sunken -borderwidth 2
  16. } else {
  17. label $w.face -bitmap @images/face \ 
  18.   -relief sunken -borderwidth 2
  19. }
  20. $w append $w.face -padx 2 -pady 0.25i}
  21. $blt_htext(widget) append $blt_htext(widget).msg \
  22.         -fill both %% added this %%
  23. global tk_library
  24. if { $tk_version < 4.0 } {
  25. label $blt_htext(widget).face \
  26.         -bitmap @$tk_library/demos/bitmaps/face  \
  27.         -relief sunken -borderwidth 2
  28. } else {
  29. label $blt_htext(widget).face \
  30.         -bitmap @$tk_library/demos/images/face  \
  31.         -relief sunken -borderwidth 2
  32. }
  33. $blt_htext(widget) append $blt_htext(widget).face -padx 2 -pady 0.25i -fill both
  34. %%.
  35. There can be many types of widgets in the same document.  For example,
  36. this is a simple %% 
  37. button $blt_htext(widget).but -bg pink -text { button } \
  38.         -command { puts stderr { a stupid message } } 
  39. $blt_htext(widget) append $blt_htext(widget).but
  40. %%. If you click on the button, it prints a stupid message. 
  41. Any Tk widget can be used, including %%
  42. checkbutton $blt_htext(widget).ckbut -bg lightblue -text { check buttons } \
  43.         -command { puts stderr { check button pressed } } 
  44. $blt_htext(widget) append $blt_htext(widget).ckbut
  45. %%, %%
  46. radiobutton $blt_htext(widget).rdbut -bg mediumseagreen -text { radio buttons } \
  47.         -command { puts stderr { radio button pressed } } 
  48. $blt_htext(widget) append $blt_htext(widget).rdbut
  49. %%, 
  50. and scales %%
  51. if { $tk_version < 4.0 } {
  52. scale $blt_htext(widget).sc -showvalue true \
  53.         -length 100 \
  54.         -sliderforeground powderblue \
  55.         -sliderlength 10 \
  56.         -orient horizontal  
  57. } else {
  58. scale $blt_htext(widget).sc -showvalue true \
  59.         -length 100 \
  60.         -background powderblue \
  61.         -sliderlength 10 \
  62.         -orient horizontal  
  63. }
  64. $blt_htext(widget) append $blt_htext(widget).sc
  65. %%.  
  66.  
  67.         Widget trees can be also be included. The following example is 
  68. *borrowed* from the widget demo. It is a couple of frames surrounding a 
  69. listbox, a message, and a button widget. 
  70. %%
  71.     set w $blt_htext(widget).frame 
  72.     frame $w 
  73.     message $w.msg -font *times-medium-r-normal--*-120* -aspect 300 \
  74.             -text "A listbox containing the 50 states is displayed below, along with a scrollbar.  You can scan the list either using the scrollbar or by dragging in the listbox window with button 3 pressed.  Click the \"OK\" button when you've seen enough." -bg lightsteelblue -relief sunken
  75.     frame $w.frame -borderwidth 10 
  76.     pack append $w.frame \
  77.         [scrollbar $w.frame.scroll -relief sunken \
  78.             -command "$w.frame.list yview"] {right expand filly frame w} \
  79.         [listbox $w.frame.list -yscroll "$w.frame.scroll set" -relief sunken] \
  80.             {left expand filly frame e}
  81.     $w.frame.list insert 0 Alabama Alaska Arizona Arkansas California \
  82.         Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois \
  83.         Indiana Iowa Kansas Kentucky Louisiana Maine Maryland \
  84.         Massachusetts Michigan Minnesota Mississippi Missouri \
  85.         Montana Nebraska Nevada "New Hampshire" "New Jersey" "New Mexico" \
  86.         "New York" "North Carolina" "North Dakota" \
  87.         Ohio Oklahoma Oregon Pennsylvania "Rhode Island" \
  88.         "South Carolina" "South Dakota" \
  89.         Tennessee Texas Utah Vermont Virginia Washington \
  90.         "West Virginia" Wisconsin Wyoming
  91.     button $w.ok -text OK -command "puts stderr $w; destroy $w"
  92.  
  93.     pack append $w $w.msg {top fill} $w.frame {top expand fill} \
  94.         $w.ok {bottom fill}
  95.     $w config -bg lightsteelblue -relief sunken
  96.  
  97. $blt_htext(widget) append $w -padx 1.0i -pady 0.25i
  98. %% 
  99.  
  100. You can add you own home-grown widgets.  Here's the blt_graph widget.
  101. Beside it is the "color" demo.  Moving the scales, adjusts the background
  102. color of the graph.
  103. %%
  104. proc makeplot { widget } {
  105.  
  106.     set X { 
  107.         2.00000e-01 4.00000e-01 6.00000e-01 8.00000e-01 1.00000e+00 
  108.         1.20000e+00 1.40000e+00 1.60000e+00 1.80000e+00 2.00000e+00 
  109.         2.20000e+00 2.40000e+00 2.60000e+00 2.80000e+00 3.00000e+00 
  110.         3.20000e+00 3.40000e+00 3.60000e+00 3.80000e+00 4.00000e+00 
  111.         4.20000e+00 4.40000e+00 4.60000e+00 4.80000e+00 5.00000e+00 
  112.     } 
  113.  
  114.     $widget element create Y1 -xdata $X -ydata { 
  115.         1.14471e+01 2.09373e+01 2.84608e+01 3.40080e+01 3.75691e+01 
  116.         3.91345e+01 3.92706e+01 3.93474e+01 3.94242e+01 3.95010e+01 
  117.         3.95778e+01 3.96545e+01 3.97313e+01 3.98081e+01 3.98849e+01 
  118.         3.99617e+01 4.00384e+01 4.01152e+01 4.01920e+01 4.02688e+01 
  119.         4.03455e+01 4.04223e+01 4.04990e+01 4.05758e+01 4.06526e+01 
  120.     } -symbol line -linewidth 0 -label VGS=2.0 -fg blue 
  121.  
  122.     $widget element create a -xdata $X -ydata { 
  123.         2.61825e+01 5.04696e+01 7.28517e+01 9.33192e+01 1.11863e+02 
  124.         1.28473e+02 1.43140e+02 1.55854e+02 1.66606e+02 1.75386e+02 
  125.         1.82185e+02 1.86994e+02 1.89802e+02 1.90683e+02 1.91047e+02 
  126.         1.91411e+02 1.91775e+02 1.92139e+02 1.92503e+02 1.92867e+02 
  127.         1.93231e+02 1.93595e+02 1.93958e+02 1.94322e+02 1.94686e+02 
  128.     } -symbol cross -linewidth 0 -fg brown 
  129.  
  130.     $widget element create Y2 -xdata $X -ydata { 
  131.         2.61825e+01 5.04696e+01 7.28517e+01 9.33192e+01 1.11863e+02 
  132.         1.28473e+02 1.43140e+02 1.55854e+02 1.66606e+02 1.75386e+02 
  133.         1.82185e+02 1.86994e+02 1.89802e+02 1.90683e+02 1.91047e+02 
  134.         1.91411e+02 1.91775e+02 1.92139e+02 1.92503e+02 1.92867e+02 
  135.         1.93231e+02 1.93595e+02 1.93958e+02 1.94322e+02 1.94686e+02 
  136.     } -symbol line -linewidth 0 -label VGS=3.5 -fg green 
  137.  
  138.     $widget element create Y3 -xdata $X -ydata { 
  139.         4.07008e+01 7.95658e+01 1.16585e+02 1.51750e+02 1.85051e+02 
  140.         2.16479e+02 2.46024e+02 2.73676e+02 2.99427e+02 3.23267e+02 
  141.         3.45187e+02 3.65177e+02 3.83228e+02 3.99331e+02 4.13476e+02 
  142.         4.25655e+02 4.35856e+02 4.44073e+02 4.50294e+02 4.54512e+02 
  143.         4.56716e+02 4.57596e+02 4.58448e+02 4.59299e+02 4.60151e+02 
  144.    } -symbol line -linewidth 0  -label VGS=5.0 -fg red 
  145.  
  146.     $widget element create t -xdata $X -ydata { 
  147.         4.07008e+01 7.95658e+01 1.16585e+02 1.51750e+02 1.85051e+02 
  148.         2.16479e+02 2.46024e+02 2.73676e+02 2.99427e+02 3.23267e+02 
  149.         3.45187e+02 3.65177e+02 3.83228e+02 3.99331e+02 4.13476e+02 
  150.         4.25655e+02 4.35856e+02 4.44073e+02 4.50294e+02 4.54512e+02 
  151.         4.56716e+02 4.57596e+02 4.58448e+02 4.59299e+02 4.60151e+02 
  152.    } -symbol plus -linewidth 0  -fg purple 
  153. }
  154.  
  155. option add *Blt_graph.title  "Plot Title" 
  156. option add *Blt_graph.xTitle "X Axis Label"
  157. option add *Blt_graph.yTitle "Y Axis Label" 
  158. option add *Blt_graph.legendMapped false 
  159. option add *Blt_graph.relief ridge
  160. option add *Blt_graph.borderWidth 2
  161.  
  162. blt_graph $blt_htext(widget).g -width 200 -height 200 
  163. #-xlog true -ylog true
  164. makeplot $blt_htext(widget).g
  165. $blt_htext(widget) append $blt_htext(widget).g -padx 0.25i -pady 0.25i
  166.  
  167. %% %%
  168. #
  169. # Simple script to change colors of a window.
  170. #
  171. global xlabel ylabel red green blue grph
  172. set xlabel $blt_htext(widget).xlab
  173. set ylabel $blt_htext(widget).ylab
  174. set grph $blt_htext(widget).g
  175. set w $blt_htext(widget).cf
  176. set red 0
  177. set green 0
  178. set blue 0
  179.  
  180. option add *Scale.sliderForeground "#cdb79e"
  181. option add *Scale.activeForeground "#ffe4c4"
  182. frame $w
  183. scale $w.red -command "color red" -label "Red Intensity" \
  184.         -from 0 -to 255 -orient horizontal -bg "#ffaeb9" -length 250
  185. scale $w.green -command "color green" -label "Green Intensity" \
  186.         -from 0 -to 255 -orient horizontal -bg "#43cd80"
  187. scale $w.blue -command "color blue" -label "Blue Intensity"  \
  188.         -from 0 -to 255 -orient horizontal -bg "#7ec0ee"
  189. pack append $w $w.red {top expand fill}
  190. pack append $w $w.green {top expand fill}
  191. pack append $w $w.blue {top expand fill}
  192.  
  193. proc color {which intensity} {
  194.     global red green blue grph xlabel ylabel
  195.     set $which $intensity
  196.     set rgb [format #%02x%02x%02x $red $green $blue]
  197.     $grph config -bg $rgb
  198.     $xlabel config -bg $rgb
  199.     $ylabel config -bg $rgb
  200. }
  201.  
  202. $blt_htext(widget) append $w
  203.  
  204. %%
  205. If you click on any button in the graph, you will get the coordinate 
  206. values at the pointer location.  
  207.  
  208. The current coordinate values are %%
  209. label $blt_htext(widget).xlab -text { ??? ??? } -relief sunken
  210. label $blt_htext(widget).ylab -text { ??? ??? } -relief sunken
  211. bind $blt_htext(widget).g <ButtonPress> {labelxy [ %W invtransform %x %y ]}
  212.  
  213. proc labelxy { values } {
  214.     global xlabel ylabel
  215.     scan $values "%e %e" x y
  216.     $xlabel config -text $x
  217.     $ylabel config -text $y
  218. }
  219. $blt_htext(widget) append $blt_htext(widget).xlab -width 100 -fill x
  220. %% and %%
  221. $blt_htext(widget) append $blt_htext(widget).ylab -width 100 -fill x
  222. %%.
  223.  
  224.  
  225. There are three global variables automatically created when a hypertext
  226. file is read:
  227.  
  228.         %% 
  229. button $blt_htext(widget).l1 -text "\$blt_htext(widget)" -command "puts stdout $blt_htext(widget)" 
  230. $blt_htext(widget) append $blt_htext(widget).l1 %% is the pathname of the hypertext widget. 
  231.         %% 
  232. button $blt_htext(widget).l2 -text "\$blt_htext(file)" -command "puts stdout $blt_htext(file)" 
  233. $blt_htext(widget) append $blt_htext(widget).l2
  234. %% is the file being read and 
  235.         %% 
  236. button $blt_htext(widget).l3 -text "\$blt_htext(line)"  -command "puts stdout $blt_htext(line)"
  237. $blt_htext(widget) append l3
  238. %% is the current line number.
  239.  
  240. Click on any button and the current value is printed on standard output.
  241.  
  242. The hypertext widget works with plain text too. If you don't want
  243. to read it, click on the %% 
  244. button $blt_htext(widget).goto -text button -fg purple -bg white \
  245.         -command "global endOfText; $blt_htext(widget) gotoline \$endOfText"
  246. $blt_htext(widget) append $blt_htext(widget).goto
  247. %% to jump to the end of the plain text.
  248.  
  249.          ------------------------------------------------------
  250.  
  251. This is version 1.4 of the BLT library.  It is an extension to 
  252. Tk toolkit (it requires no patching of the Tcl or Tk libraries).  
  253.  
  254. This library works with the following releases of Tcl/Tk ONLY.
  255.  
  256.     Tcl 7.3 / Tk 3.6
  257.     Tcl 7.2 / Tk 3.5
  258.     Tcl 7.1 / Tk 3.4
  259.     Tcl 7.0 / Tk 3.3
  260.  
  261. The BLT toolkit contains the following widgets/commands:
  262.  
  263. 1) Drag-n-drop command: blt_drag&drop
  264.     Updated version of Michael McLennan's drag and drop command
  265.     (it's still maintained by Michael). 
  266.  
  267. 2) Hypertext widget: blt_htext
  268.     Allows text and Tk widgets to combined in a single scroll-able 
  269.     window.
  270.  
  271. 3) Busy window: blt_busy
  272.     For handling user-interaction when the application is "busy".
  273.     Manages an invisible "busy" window which prevents further 
  274.     user device (keyboard, mouse, button, etc.) interactions.
  275.     Also provides a different cursor which supersedes application
  276.     cursors.
  277.  
  278. 4) Bitmap command: blt_bitmap
  279.     Lets you read and write bitmaps from Tcl. Can define X bitmaps  
  280.     and create bitmaps from text strings.  Other options query any 
  281.         loaded X bitmap.
  282.  
  283. 5) Background "exec" command: blt_bgexec
  284.     Like "exec ... &", but collects the output of the detached 
  285.     UNIX subprocesses and sets a Tcl variable upon their completion.
  286.     Can be used with "tkwait variable" to handle application's 
  287.     expose events, etc. while waiting for subprocesses to finish.  
  288.  
  289. 6) Table geometry manager: blt_table
  290.     Specify window placements as table row,column positions. Also
  291.     has many options for placing constraints on window resizes.
  292.  
  293. 7) Barchart widget: blt_barchart
  294.     
  295. 8) XY graph widget: blt_graph
  296.  
  297. 9) Window option command: blt_win
  298.     Lets you raise, lower, map, or, unmap any window.  
  299.  
  300. 10) Watch commands: blt_watch
  301.     Lets you specify Tcl procedures to be run before and/or
  302.     after every Tcl command.  May be used for logging,
  303.     tracing, profiling, or debugging or Tcl code.
  304.  
  305. 11) Simple command trace: blt_debug
  306.     Simply prints out each Tcl command before it's executed.  
  307.  
  308. 12) Cutbuffer and bell commands: blt_cutbuffer, blt_bell
  309.     The commands are derived from the "bellcut" extensions and are 
  310.     provided as a convenience.  Credit should go to the author(s) 
  311.     (I can't remember who they are. Sorry) for this work.
  312.  
  313. ---------
  314.  
  315. Changes since BLT-1.3:
  316.  
  317. 1. Axis not re-scaling when changing log/linear scale.
  318.  
  319. 2. New command: "blt_watch" arranges for Tcl procedures to be 
  320.    called before and/or after the execution of every Tcl command. 
  321.    This command may be used in the logging, profiling, or tracing of 
  322.    Tcl code.
  323.  
  324. 3. Bug fixes:  See the file "ChangeLog" for details.  Thanks to all 
  325.    those who've sent me their reports and fixes.  
  326.  
  327. ---------
  328.  
  329. Changes since BLT-1.2:
  330.  
  331. 1. Fixed manual scaling bug (seen in ./demos/graph2)
  332.  
  333. 2. New feature: C interface to reset "blt_graph" element data.
  334.  
  335. 3. Bug fixes:  See the file "ChangeLog" for details.  Again, thanks 
  336.    to all those who've sent me reports.  
  337.  
  338. ---------
  339.  
  340. Changes since BLT-1.1:
  341.  
  342. 1. Fixed bug (coredump) in "blt_bgexec" command introduced 
  343.    last release.
  344.  
  345. 2. Fixed bug (error) in "blt_graph" and "blt_barchart" commands 
  346.    introduced in last release.  Bug doesn't allow axis -min, -max options 
  347.    to be reset to autoscale.
  348.  
  349. 3. Fixed bug in Kosherdill installation.
  350.  
  351. 4. New feature in "blt_graph" and "blt_barchart".
  352.    Added alternate x and y axes (x2, y2).  
  353.    Moved axis title options to their respective axis commands
  354.     .graph configure -xtitle "X Axis Title"
  355.    becomes
  356.     .graph xaxis configure -title "X Axis Title"
  357.  
  358. ---------
  359.  
  360. Changes since BLT-1.0:
  361.  
  362. 1. Many changes to configuration and install files.  Hopefully this
  363.    is an improvement.
  364.  
  365. 2. New options in "blt_graph" to detect closest point and highlight
  366.    single element data points.
  367.  
  368. 3. New option in "blt_bitmap" command lets you create bitmaps of rotated 
  369.    text strings.
  370.  
  371. 4. Restructured BLT library to facilitate loading as a shared object.
  372.  
  373. 5. Lots of bug fixes:  See the file "ChangeLog" for details.  Again, thanks 
  374.    to all those who've sent me reports.  
  375.  
  376. ---------
  377.  
  378. Changes since BLT-1.0b2:
  379.  
  380. 1. First BLT application.  
  381.                 Kosher Dill
  382.         ( KOmprehensive Storage HandlER / Disk ILLustrator )
  383.  
  384.        ---------------------------------------------------------------
  385.           Copyright (c) 1993  AT&T Bell Laboratories
  386.         Michael J. McLennan (michael.mclennan@att.com)
  387.        ---------------------------------------------------------------
  388.  
  389.        Kosher Dill is a simple utility for managing disk usage.  It
  390.        provides a graphical representation of the system "du" command,
  391.        along with drag&drop facilities for exploring, compressing
  392.        and removing files.
  393.  
  394.    It can be found in the new "blt-1.0/applications" directory.
  395.  
  396. 2. Drag-and-drop facility "blt_drag&drop".  Michael McLennan has updated
  397.    and added his drag-and-drop command.  
  398.  
  399. 3. Shared library target (for supported systems):  I've been able to test
  400.    this only on SunOS 4.x, SunOS 5.x, and HP-UX 9.01 systems.
  401.  
  402. 4. Add -updatevar flag to "blt_bgexec":  You can now get partial updates
  403.    of output as the program is running.  See the script "demos/bgexec".
  404.  
  405. 5. Library directory: This directory contains the drag-n-drop protocols
  406.    and the PostScript prolog for graph and barchart.  The path can be
  407.    set in the following ways:
  408.     
  409.     - compiled into the library.
  410.     - set by the environment variable "BLT_LIBRARY"
  411.     - set by the Tcl variable "blt_library"
  412.  
  413. 6. Lots of bug fixes:  See the file "ChangeLog" for details.  Thanks to 
  414.    all those who've sent me reports.  I really appreciate it.  
  415.  
  416. ---------
  417.  
  418. How to get and test BLT:
  419.  
  420. The following describes how to get and install the BLT library.
  421.  
  422. 0. FTP the distribution from harbor.ecn.purdue.edu
  423.  
  424.     ftp harbor.ecn.purdue.edu
  425.     cd pub/tcl/extensions
  426.     binary 
  427.     get BLT-1.4.tar.Z
  428.     quit
  429.  
  430. 1. Uncompress and untar the distribution file.  
  431.  
  432.     zcat BLT-1.4.tar.Z | tar -xvf - 
  433.  
  434.  
  435.    This will create a directory "blt-1.4" with the following 
  436.    subdirectories:
  437.     
  438.                         blt-1.4
  439.          ______________|_________________
  440.              |          |       |      |    |
  441.         applications  demos  library  man  src
  442.                                             |
  443.                                           shared
  444.  
  445. 2. Run ./configure
  446.  
  447.    Go into the "blt-1.4" directory 
  448.  
  449.     cd blt-1.4
  450.  
  451.    and run the auto-configuration script "./configure"
  452.  
  453.     ./configure 
  454.  
  455.    * If you want to use gcc, it's "./configure -with-gcc"
  456.  
  457.     ./configure -with-gcc
  458.  
  459.    * By default, the demo program, libBLT.a, the library files, and
  460.      manual pages will be installed in "/usr/local/blt".  You can 
  461.      change this by giving the -prefix option to ./configure.
  462.  
  463.     ./configure -prefix=/depot/stuff/blt
  464.     
  465.   You may be queried for the location of the Tcl and Tk libraries, if
  466.   "configure" can't find them in the standard locations.
  467.  
  468.   The configure script creates an include file "src/bltConfig.h".
  469.   It will also generate new Makefiles from their respective templates 
  470.   (Makefile.in).
  471.  
  472.     Makefile.in             ==> Makefile
  473.     src/Makefile.in            ==> src/Makefile
  474.     src/shared/Makefile.in    ==> src/shared/Makefile
  475.     man/Makefile.in        ==> man/Makefile
  476.     library/Makefile.in    ==> library/Makefile
  477.  
  478.   If "configure" can't find something (e.g. it can't find the X libraries),
  479.   edit the file "config.status" and run it.
  480.  
  481.     ./config.status
  482.  
  483.   Otherwise, you'll have to edit the Makefiles files by hand.
  484.  
  485.  
  486. 3. Compile the demonstation program "blt_wish".
  487.  
  488.     make 
  489.  
  490.  
  491. 4. Test by running the demos. 
  492.  
  493.    Go into the demos directory 
  494.     
  495.     cd demos
  496.  
  497.    and run the test scripts.
  498.     
  499.     ./graph
  500.  
  501.    If your system doesn't support "#!" in shell scripts, then it's
  502.  
  503.     ../blt_wish -f ./graph
  504.  
  505.  
  506. 5. Installing BLT
  507.  
  508.    The following directories will be created when BLT is installed.  
  509.    By default, the top directory is /usr/local/blt.  
  510.  
  511.        _____________|__________
  512.        |      |        |      |  
  513.       bin    lib     library man
  514.      
  515.    You can change the top directory by supplying the -prefix option to
  516.    ./configure.
  517.  
  518.    * If you don't install BLT, you will need to set the BLT_LIBRARY
  519.      environment variable or the Tcl variable "blt_library" in your
  520.      scripts.  Otherwise, you may not be able generate PostScript 
  521.      output for graphs and barcharts, or use the drag&drop facility 
  522.      properly.
  523.  
  524.  
  525. 6. BLT Applications
  526.  
  527.    In the "blt-1.4/applications" directory, there is the first 
  528.    application called "kosherdill".  It has its own README and
  529.    configure script.  
  530.  
  531. 7. Creating a shared library.
  532.  
  533.    This is currently available (and tested) on the following 
  534.    systems:
  535.  
  536.     SunOS 4.x
  537.     SunOS 5.x
  538.     HP-UX 9.01
  539.  
  540.    From the "blt-1.4" directory:
  541.  
  542.     make sharedlib
  543.  
  544.    This will create a shared library in the directory src/shared.
  545.  
  546.  
  547. 8. Adding BLT to your program.
  548.  
  549.    Add the following lines to your program's Tcl_AppInit routine 
  550.  
  551.     if (Blt_Init(interp) != TCL_OK) {
  552.         return TCL_ERROR;
  553.          }
  554.  
  555.    Link with libBLT.a
  556.  
  557.    and that's all there's to it.
  558.  
  559. 9. Send bugs reports, correspondence, etc. to
  560.  
  561.        george.howlett@att.com
  562.  
  563.  
  564.  
  565. %%
  566. global endOfText
  567. set endOfText [expr $blt_htext(line)-1 ]
  568.  
  569. global updateInterval count graph
  570. global Red Green Blue
  571. set updateInterval 2000
  572. set count 0
  573. set Red bb
  574. set Green 00
  575. set Blue 33
  576.  
  577. option add *Blt_barchart.title "Bar Chart" 
  578. option add *Blt_barchart.xTitle "X"
  579. option add *Blt_barchart.yTitle "Y"
  580. option add *Blt_barchart.y2Title "Y"
  581. option add *Blt_barchart.ySubTicks 0
  582. option add *Blt_barchart.xTicks 0
  583. option add *Blt_barchart.legendMapped false
  584. option add *Blt_barchart.AxisFont *-Courier-Bold-R-Normal-*-80-* 
  585. option add *Blt_barchart.y2Mapped true
  586.  
  587. blt_barchart $blt_htext(widget).b 
  588.  
  589. $blt_htext(widget) append $blt_htext(widget).b \
  590.         -relwidth 1.0 -relheight 0.5 -fill both
  591. set graph $blt_htext(widget).b
  592.  
  593. proc AnimateBarchart {  } {
  594.     global updateInterval
  595.     global count graph Red Blue Green
  596.     
  597.     if { [info commands $graph] != $graph } {
  598.         return
  599.     }   
  600.     incr count
  601.     if { $count > 16 } {
  602.         $graph element delete [lindex [$graph element show] 0]
  603.     }
  604.     set color [format "%x" [expr $count%16]]
  605.     set Green ${color}${color}
  606.     $graph element create $count -data { $count sin($count*0.1)} \
  607.         -fg #${Red}${Green}${Blue} -bg brown -mapy both
  608.     after $updateInterval AnimateBarchart
  609. }
  610. AnimateBarchart
  611.  
  612. %%
  613.  
  614.         Press %%
  615. button $blt_htext(widget).quit -command { destroy . } -text {Quit} -bg pink
  616. $blt_htext(widget) append quit
  617. %% to remove the window.
  618.  
  619.